Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Visual Studio Main Shortcuts

Editing

Ctrl+K,C – comment line
Ctrl+K,U – uncomment line
Ctrl+D – duplicate line
Ctrl+Shift+L – delete line without adding it to the clipboard
Alt+<Up/Down arrows> – move line up/down

Ctrl+K,F – format the selected block
Ctrl+K,D – format the entire file
Ctrl+K,E – clean up the code in the file (according to the rules you set, for example, removing unnecessary usings)

Ctrl+K,S – insert snippet (if, try, for block, etc.), or enclose the selected code in a block
Alt+Shift+<arrows> (Alt+<mouse selection>) – edit by columns
Ctrl+Alt+<place the cursor with the mouse> – multi-cursor input (edit in several places at once)

Ctrl+G – go to line
Ctrl+K,K – leave bookmark
Ctrl+K,N – go to next bookmark

Ctrl+, (Ctrl+T) – search by code in project
Ctrl+Q – search by IDE tools

F12 (Ctrl+<mouse click>) – go to definition
Alt+F12 – peek definition (definition hint in inline window)
Ctrl+F12 – go to implementation
Shift+F12 – find all references

Ctrl+Shift+space – method arguments hint
Ctrl+[,S – mark current file in solution explorer
Ctrl+; – search in solution explorer

Ctrl+M,O – collapse all methods to definitions
Ctrl+M,P – expand all methods
Ctrl+M,M – collapse/expand the current method
Ctrl+M,L – collapse/expand all outlining

Shift+Alt+. – Add the next matching text as a selection
Shift+Alt+; – Add all matching text as selections
Shift+Alt+, – Remove last selected occurrence
Shift+Alt+/ – Skip next matching occurrence

For ASP.NET
Ctrl+M,G – go from a controller method to a view or vice versa

Refactoring

Ctrl+. (Alt+Enter) – refactoring hints
Ctrl+R,R – rename
Ctrl+R,M – extract selected code to method
Ctrl+R,I – extract interface from class
Ctrl+R,V (Ctrl+R,O) – reorganize method parameters

Snippets

"prop",Tab,Tab – create a property
"ctor",Tab,Tab – create a constructor
Tab,Tab also works for other popular keywords (if, for, switch, etc.)

Debugging

F9 – create a breakpoint
Ctrl+Alt+B – open window with all breakpoints
Ctrl+Shift+F9 – delete all breakpoints